package com.lsu.app.bean;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;

import java.io.Serializable;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;

/**
 * 评论
 * @Date 2023-10-18 20:25:48
 * @author hjj
 */
@Data
@TableName("comment")
@ApiModel(value="Comment对象", description="评论")
public class Comment implements Serializable {

    @ApiModelProperty("#id")
    private Integer id;

    @NotNull(message="[评论类型(1课程评论，2课程视频评论，3话题评论)]不能为空")
    @ApiModelProperty("评论类型(1课程评论，2课程视频评论，3话题评论)")
    private Integer type;

    @ApiModelProperty("#课程/课程视频/话题所属的用户id")
    private Integer targetUserId;

    @NotNull(message="[关联的课程id/课程视频id/话题id （看type值）]不能为空")
    @ApiModelProperty("关联的课程id/课程视频id/话题id （看type值）")
    private Integer linkId;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("关联课程封面")
    private String linkCoverImg;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("关联课程名称")
    private String linkName;

    @JsonIgnore //数据库中不会输出该字段到json中
    @ApiModelProperty("#评论用户id")
    private Integer userId;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("用户昵称")
    private String nickname;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("用户角色")
    private String userRole;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("用户头像url")
    private String UserUrl;

    @Size(max= 255,message="编码长度不能超过255")
    @ApiModelProperty("评论内容")
    private String content;

    @ApiModelProperty("#创建时间")
    private String createTime;

    @ApiModelProperty("#热度（点赞数）")
    private Integer heat;

    @TableField(exist = false) //该字段不存在于数据库中
    @ApiModelProperty("#自身是否点赞")
    private Integer selfLike;

    public Comment() {
    }

    public Comment(Integer targetUserId,Integer type, Integer linkId, Integer userId, String content, String createTime) {
        this.targetUserId=targetUserId;
        this.type = type;
        this.linkId = linkId;
        this.userId = userId;
        this.content = content;
        this.createTime = createTime;
    }
}
